package com.standardoperationapp.net;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import io.reactivex.observers.DisposableObserver;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * 作业计划API
 */
public class OperationApi {

    //根据当前userid查询作业计划
    public static void selectWorkPlanListByid(DisposableObserver<ResponseBody> subscriber) {
        int userId = 3009;
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .selectWorkPlanListByid(userId);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    //根据当前作业计划id查询卡控点列表
    public static void selectCardPointListById(int planId, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .selectCardPointListById(planId);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    //  查看卡控点执行操作流程，并判断是否有前序返回完成情况
    //  接口说明：查询当前卡控点操作流程，并校验是否完成前序
    //          查看当前卡控点是否有前序要完成，如果有前序工作未完成，查看需要完成几个，是都需要完成还是只完成一个就行
    //          返回的是当前卡控点所有执行方法，如果没有或者该点的前序未完成则报错
    public static void selectPointOperateByPointId(int PointId, int planId,int implementId,DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .selectPointOperateByPointId(PointId, planId,implementId);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    //查看当前这个用户今天是否需要被提醒，传递进来userid，返回的是今天所有需要提醒的时间
    public static void queryReminderTime(int userId, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .queryReminderTime(userId);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    //酒精、人脸检测查询接口
    // 参数businesstype：drink 为酒精测试 face 为人脸识别
    public static void tabdutyinfo(String type, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .tabdutyinfo(type);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    //工器具核验卡控点查询工器具接口
    public static void getDetailTools(String planId, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .getDetailTools(planId);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    //工器具核验卡控点查询工器具接口
    public static void reportZuoBiao(String userName, String zuoBiao, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .reportZuoBiao(userName, zuoBiao);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    //工器具核验提交接口
    public static void updateTools(List map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .updateTools(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    //卡控点拍照/录音结果数据提交接口
    public static void updateImage(List map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .updateImage(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    //记录卡控点计划列表实施
    //接口说明
    //记录卡控点计划列表实施接口，记录当前卡控点下的每一步操作的具体完成情况，支持某一个操作重复提交，只要最后完成即可
    //如果所有操作都完成，则修改卡控点完成状态并记录完成时间，
    //如果有一个操作没有完成，则无法更新卡控点完成状态，
    public static void recordPliAndDetail(Map<String, Object> map, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .recordPliAndDetail(map);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

    //记录联控防护报警
    public static void recordJointControlWarn(int executableId, int workPointId, int planId, DisposableObserver<ResponseBody> subscriber) {
        Observable<ResponseBody> observable = RetrofitFactory.getInstance().getHttpApi()
                .recordJointControlWarn(executableId, workPointId, planId);
        RetrofitFactory.getInstance().toSubscribe(observable, subscriber);
    }

}
